import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";

Vue.filter('time', function (val) {
  //将时间转换为对象
  //获取到年月日时分秒，然后根据需求拼杰字符串
  var date = new Date(val)
  var Y = date.getFullYear();
  var M = date.getMonth();
  var D = date.getDate();
  var h = date.getHours();
  var f = date.getMinutes() + '';
  f = f.padStart(2, 0)
  var m = date.getSeconds() + '';
  m = m.padStart(2, 0)
  return `${Y}-${M}-${D} ${h}:${f}:${m}`
  //padStart(目标位数,"填充的字符") 不够目标位数  用填充的字符来填充

})
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);

//echarts配置
import * as echarts from 'echarts';
Vue.prototype.$echarts = echarts;

import axios from './http';//开启路由拦截器
// import axios from 'axios';
Vue.prototype.$http=axios;

Vue.config.productionTip = false;

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");
